package com.bosssoft.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bosssoft.entity.po.FibUserRolePO;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * @author Li kexi
 * Created on 2021/8/16.14:32
 */
public interface FibUserRoleMapper extends BaseMapper<FibUserRolePO> {

    @Select("SELECT role_id \n" +
            "FROM fib_user_role \n" +
            "WHERE user_id = #{userId} " +
            "AND deleted = 1")
    Long getRoleByUserId(Long userId);

    @Update("UPDATE fib_user_role \n" +
            "SET deleted = #{status} \n" +
            "WHERE id = #{id} ")
    int banUserRoleById(Long id, Integer status);

    int updateBatch(List<FibUserRolePO> list);

    int updateBatchSelective(List<FibUserRolePO> list);

    int batchInsert(@Param("list") List<FibUserRolePO> list);

    int insertOrUpdate(FibUserRolePO record);

    int insertOrUpdateSelective(FibUserRolePO record);
}